<template>
  <div class="count">
    <table border="0" cellPadding="0" cellSpacing="0">
      <tbody>
        <tr v-for="(row, index) in rows" :key="index">
          <td>计{{ index + 1 }}</td>
          <td><rb-tag>空闲</rb-tag></td>
          <td
            v-if="index <= 1"
            :colspan="index == 0 ? 1 : cloumns - 2"
            :rowspan="index === 0 ? 1 : rows - 1"
          >
            <rb-tag v-if="index === 0">空闲</rb-tag>
            <div v-else class="count-table-center">
              <div class="count-table-center-content">
                <div class="count-table-center-content-left">
                  <div class="count-table-center-content-left-top">
                    <div class="count-table-center-item">
                      <div class="count-table-center-item-label">
                        计数工作台
                      </div>
                      <div class="count-table-center-item-value">计2</div>
                    </div>
                    <div
                      class="count-table-center-item"
                      style="margin-left: 6.875vw"
                    >
                      <div class="count-table-center-item-label">
                        最大容量设置
                      </div>
                      <el-input
                        class="count-table-center-item-input"
                        v-model="form.max"
                      ></el-input>
                    </div>
                    <div
                      class="count-table-center-item"
                      style="margin-left: 6.3542vw"
                    >
                      <div class="count-table-center-item-label">当前数量</div>
                      <div class="count-table-center-item-count">
                        <div class="count-table-center-count-btn-container">
                          <img
                            src="@/assets/images/increase.png"
                            :class="{
                              'count-table-center-count-btn': true,
                            }"
                            @click="handleIncrease"
                          /><img
                            src="@/assets/images/reduce.png"
                            :class="{
                              'count-table-center-count-btn': true,
                              'count-table-center-count-btn-disable':
                                !form.count || form.count <= 0,
                            }"
                            @click="handleReduce"
                          />
                        </div>
                        <div class="count-table-center-count-value">
                          {{ form.count || 0 }}
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="count-table-center-content-left-bottom">
                    <div class="count-table-center-form-item">
                      <div class="count-table-center-form-item-label">
                        工厂单号
                      </div>
                      <div class="count-table-center-form-item-value">
                        23-1302
                      </div>
                    </div>
                    <div class="count-table-center-form-item">
                      <div class="count-table-center-form-item-label">
                        模具型号
                      </div>
                      <div class="count-table-center-form-item-value">
                        RB-002
                      </div>
                    </div>
                    <div class="count-table-center-form-item">
                      <div class="count-table-center-form-item-label">
                        颜色编号
                      </div>
                      <div class="count-table-center-form-item-value">
                        白色01
                      </div>
                    </div>
                    <div class="count-table-center-form-item">
                      <div class="count-table-center-form-item-label">尺码</div>
                      <div class="count-table-center-form-item-value">39</div>
                    </div>
                  </div>
                  <div class="count-table-center-submit-container">
                    <rb-button
                      style="
                        width: 22.8125vw;
                        height: 4.375vw;
                        font-size: 1.6667vw;
                      "
                      >结束分拣</rb-button
                    >
                  </div>
                </div>
                <div class="count-table-center-content-right">
                  <img
                    style="width: 22.9167vw; height: 9.375vw"
                    src="@/assets/images/print.png"
                  />
                  <div class="count-table-center-print">
                    <div class="count-table-center-form-item">
                      <div class="count-table-center-form-item-label">
                        工厂单号
                      </div>
                      <div class="count-table-center-form-item-value">
                        23-1302
                      </div>
                    </div>
                    <div class="count-table-center-form-item">
                      <div class="count-table-center-form-item-label">
                        模具型号
                      </div>
                      <div class="count-table-center-form-item-value">
                        RB-002
                      </div>
                    </div>
                    <div class="count-table-center-form-item">
                      <div class="count-table-center-form-item-label">
                        颜色编号
                      </div>
                      <div class="count-table-center-form-item-value">
                        白色01
                      </div>
                    </div>
                    <div class="count-table-center-form-item">
                      <div class="count-table-center-form-item-label">尺码</div>
                      <div class="count-table-center-form-item-value">39码</div>
                    </div>
                    <div class="count-table-center-form-item">
                      <div class="count-table-center-form-item-label">
                        分拣日期
                      </div>
                      <div class="count-table-center-form-item-value">
                        2024-05-12
                      </div>
                    </div>
                    <div class="count-table-center-form-item">
                      <div class="count-table-center-form-item-label">
                        分拣机台
                      </div>
                      <div class="count-table-center-form-item-value">计2</div>
                    </div>
                    <div class="count-table-center-form-item">
                      <div class="count-table-center-form-item-label">数量</div>
                      <div class="count-table-center-form-item-total">34</div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </td>
          <td v-if="index <= 0"><rb-tag>空闲</rb-tag></td>
          <td v-if="index <= 0"><rb-tag>空闲</rb-tag></td>
          <td v-if="index <= 0"><rb-tag>空闲</rb-tag></td>
          <td v-if="index <= 0"><rb-tag>空闲</rb-tag></td>
          <td v-if="index <= 0"><rb-tag>空闲</rb-tag></td>
          <td><rb-tag>空闲</rb-tag></td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script setup>
const rows = ref(12);
const cloumns = ref(8);
const form = ref({
  max: 0,
});
const handleIncrease = () => {
  if (!form.value.count) {
    form.value.count = 0;
  }
  form.value.count++;
};
const handleReduce = () => {
  if (form.value.count <= 0) return;
  form.value.count--;
};
</script>

<style lang='scss'>
.count {
  padding: 20px 24px;
  table {
    width: 100%;
    td {
      padding: 8px 16px;
    }
  }
  .count-table-center {
    display: flex;
    flex-direction: column;
    height: 808px;
    overflow: hidden;
    .count-table-center-content {
      flex: 1;
      padding: 50px 60px 0 60px;
      display: flex;
      border-radius: 12px;
      box-shadow: var(--box-shadow);
      background-image: var(--bg-gradient-color);
      .count-table-center-content-left {
        .count-table-center-content-left-top {
          display: flex;
          .count-table-center-item {
            display: flex;
            flex-direction: column;
            .count-table-center-item-label {
              font-size: 26px;
            }
            .count-table-center-item-value {
              margin-top: 54px;
              font-size: 34px;
              font-weight: bold;
            }
            .count-table-center-item-input {
              margin-top: 24px;
              .el-input__wrapper {
                width: 154px;
                padding: 32px 10px;
                background-image: var(--bg-gradient-color);
              }
              input {
                text-align: center;
                font-size: 34px;
                color: #000000;
                font-weight: bold;
              }
            }
            .count-table-center-item-count {
              padding-top: 20px;
              display: flex;
              align-items: center;
              gap: 40px;
              .count-table-center-count-btn-container {
                display: flex;
                flex-direction: column;
                align-items: center;
                gap: 14px;
              }
              .count-table-center-count-btn {
                width: 50px;
                height: 50px;
                cursor: pointer;
              }
              .count-table-center-count-btn-disable {
                cursor: not-allowed;
                opacity: 0.4;
              }
              .count-table-center-count-value {
                font-size: 34px;
                color: #000000;
                font-weight: bold;
              }
            }
          }
        }
        .count-table-center-content-left-bottom {
          line-height: 1;
          flex: 1;
        }
        .count-table-center-form-item {
          display: flex;
          align-items: center;
          gap: 120px;
          margin-top: 70px;
          .count-table-center-form-item-label {
            width: 140px;
            font-size: 32px;
            font-weight: bold;
            text-align: justify;
            text-align-last: justify;
          }
          .count-table-center-form-item-value {
            font-size: 30px;
            font-weight: bold;
          }
        }
      }
      .count-table-center-submit-container {
        margin-top: 40px;
      }
      .count-table-center-content-right {
        flex: 1;
        margin-left: 100px;
        .count-table-center-print {
          margin-top: 50px;
          padding: 6px 34px;
          width: 440px;
          height: 494px;
          box-shadow: var(--box-shadow);
          .count-table-center-form-item {
            display: flex;
            align-items: center;
            gap: 70px;
            margin-top: 38px;
            line-height: 1;
            .count-table-center-form-item-label {
              width: 88px;
              font-size: 20px;
              text-align: justify;
              text-align-last: justify;
            }
            .count-table-center-form-item-value {
              font-size: 20px;
              font-weight: bold;
            }
            .count-table-center-form-item-total {
              font-size: 36px;
              font-weight: bolder;
            }
          }
        }
      }
    }
  }
  .rb-tag {
    width: 190px;
    height: 54px;
  }
}
</style>